package com.github.gexiao.middleware.hystrix.annotation;

import com.github.gexiao.middleware.hystrix.service.FallbackHandler;
import com.github.gexiao.middleware.hystrix.service.impl.DefaultFallbackHandler;
import com.github.gexiao.middleware.hystrix.service.impl.DefaultHystrixHandler;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 熔断器注解
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface DoHystrix {
    /**
     * 超时熔断时间
     *
     * @return
     */
    int timeout() default 0;

    /**
     * 返回消息
     *
     * @return
     */
    String msg() default "超时熔断";

    Class<? extends FallbackHandler> fallbackHandler() default DefaultFallbackHandler.class;

    Class<?> hystrixHandler() default DefaultHystrixHandler.class;
}
